# 测试用例
import numpy as np
import math
import random

print("全连接层：正在遍历批次:  17 ...\n全连接层：正在遍历批次:  18 ...\n全连接层：正在遍历批次:  19 ...\n全连接层：正在遍历批次:  20 ...\n全连接层：正在遍历批次:  21 ...\n全连接层：正在遍历批次:  22 ...全连接层：正在遍历批次:  23 ...\n全连接层：正在遍历批次:  24 ..\nloss =  [[0.18731757]\n[0.11448564]\n[0.17161019]]")

# 30
# nn = np.array([[1,2],[3,4],[5,6]])
# uu = nn
# nn = np.multiply( nn , 3 )
# uu -= nn
# print( uu )

# 29
# def unpool_oneimg( martix , size ):
#     output_list = []
#     for index_i in range( 0 , martix.shape[0] ):
#         for index_j in range( 0 , martix.shape[1] ):
#             martix_tmp = np.ones((size,size)) * martix[index_i,index_j] / size ** 2
#             if index_j == 0:
#                 output = martix_tmp
#             else:
#                 output = np.append( output , martix_tmp , axis=1 )
#             # print( output.shape )
#         output_list.append( output )
#
#     martix_output = output_list[0]
#     for index in range( 1 , len( output_list ) ):
#         print( output_list[index].shape )
#         martix_output = np.append( martix_output , output_list[index] , axis=0 )
#     return martix_output
# nn = np.array([[1,2],[3,4],[5,6]])
# nn = unpool_oneimg( nn , 3 )
# print( nn.shape )

# 28 矩阵拼接
# nn = np.array([[1,2],[3,4],[5,6]])
# for index_i , element in enumerate( nn ):
#     print( index_i , element )



# 27
# x = 2
# nn = np.array([[x]])
# print( nn.shape )

# 26
# a = random.random()
# print( a )

# 25

# mm = [1,2,3]
# uu = [4,5,6]
# mm -= uu
# print( mm )

# 24
# nn = np.array([[1],[2],[3]])
# print(nn.shape)
# nn = nn.reshape(-1)
# print(nn.shape)

# 23
# nn = [ np.array([1,2,3]) , np.array([1,2,3]) ]
# nn = np.mat( nn )
# print( nn )
# print( nn.shape )

# 22
# nn = [ [1,2,3] , [2,3,4] ]
# nn = np.mat( nn )
# print( nn.shape )

# 21
# uu = np.array([[1,2,3]])
# nn = np.array([[1,2,3]])
# print( uu * nn )
# print( uu.shape )
# uu = math.exp( uu )
# print( math.log( uu[:] ) )
# print( np.dot( uu , nn ) )
# print( uu.shape , nn.shape )
# print( uu * nn )

# 20
# uu = np.array([1,2,3])
# print( uu.shape )
# uu = np.expand_dims(uu, axis=1)
# print( uu.shape )
# # nn = np.array([[1,2,3],[4,5,6]])
# # s = np.sum(nn)
# # print(s)

# 19
# nn = [ np.array([[1,2,3],[4,5,6]]) , np.array([[1,2,3],[4,5,6]]) ]
# mm = [ np.array([[1,2,3],[4,5,6]]) , np.array([[1,2,3],[4,5,6]]) ]
# uu = np.dot( nn[:] , mm[:] )
# print( uu )

# 18
# nn = np.array([[1,2,3],[4,5,6]])
# mm = np.array([[1,2,3],[4,5,6]])
# # 矩阵转列表
# # ll = nn[:,0]
# # ll.tolist()
# ll = nn
# ll.tolist()
# print( ll )
# # print(nn.shape)
# # print(nn)
# # print(np.sum(nn,axis=1) / nn.shape[1] )


# 17
# uu = np.array([[1],[2],[3]])
# uu = uu.squeeze()
# print( uu )
# print( uu .shape )

# 16
# nn = np.array([[1,2,3],[1,2,3]])
# uu = np.array([1,2,3])
# ll = [ uu * 3 ]
# print( ll )
# print( np.dot(nn,uu))

# 15
# ll = [1,2,3,4]
# for index in range( len(ll) , -1 , -1 ):
#     print(index)

# 14
# ll = [1,2,3,4]
# print( ll[:,0] )
# for index in ll:
#     if index == ll[-1]:
#         print( " right ")
#     else:
#         print(index)

# 13
# nn = np.array([1,2,3])# 3*1
# uu = np.array([[4,5,6] , [4,5,6]])  #2*3
# xx = np.dot( uu , nn )
# print( xx )

# 12
# def softmax( input_data ): # input_data [ [x1,x2,x3] , [1,0,0] ] * batch
#     # math.exp(x)
#     for batch in input_data: # 遍历批次
#         sum_tmp = 0
#         for index_sum in range( 0 , len( batch[0] ) ): # 求出分母
#             e_zc = math.exp( batch[0][index_sum] )
#             sum_tmp += e_zc
#         softmax_z = [] # 用以更换 [x1,x2,x3]
#         for index in range( 0 , len( batch[0] ) ): # 遍历 x1,x2,x3
#             # softmax_z_i = math.exp( batch[0][index] ) / sum_tmp
#             softmax_z_i = 99
#             softmax_z.append( softmax_z_i )
#         batch[0] = softmax_z
# ll = [ [ [1,2,3] , [1,0,0] ] , [ [1,2,3] , [1,0,0] ] ]
# softmax( ll )
# print( ll )

# 11
# ll = [ 1 , 2 , 3 ]
# sum_all = sum( math.exp( ll ) )
# print( sum_all )

# 10
# nu = np.array([ [1,2] , [2 , 3] ])
# a = sum( sum( nu ) )
# print( a )
# print( a.shape )

# 9
# li = [ 1.5 , 2.2 , 3.2 ]
# print(li)
# nu = np.mat(li)
# print( nu )
# li = nu.tolist()
# print(li[0])

# 8
# li = [1,2]
# print(li[-1])

# 7
# mar = np.array( [1,2] )
# print( mar[0] )
# mar = np.array([ [1,2] , [3,4]])
# li = [99, 100]
# mar[0,0] = li
# print(mar)

# 6
# mar = np.array([ [1,2] , [3,4]])
# def fun( martix ):
#     martix[0,0] = 999
#     return martix
# mar = fun( mar )
# print( mar )

# 5
# np.random.seed(3)
# a = np.random.rand( 10 )
# b = np.random.rand( 10 )
# print( a )
# print( b )

# 4
# size = 3
# print( int(size/2))

# def batches_train_set( train_set , batches ):
#     train_set_batches = [] # 结果
#     length_train = len( train_set )
#     len_batches = int ( length_train / batches )
#     for index in range( 0 , batches ):
#         train_tmp = train_set[ index * len_batches : index * len_batches + len_batches ]
#         train_set_batches.append( train_tmp )
#     return train_set_batches
# train_set = [1,2,3,4,5,6,7,8,9,10]
# train_set_batches = batches_train_set( train_set , 2 )
# for index in train_set_batches:
#     print( index )

# 3
# numpy = np.array([ [43,65,123] , [132,12,233]])
# print( numpy / 255 )

# numpy = np.zeros((3,3))
# print( numpy.shape[0] )

# 2
# list = [1,2,3,4,5]
# print( list[:-2])
# print( list[: int( len(list)/2 ) ])
# print( list[ int( len(list)/3 ) :])

# 1
# arr = np.array([1,2,3])
# list = []
# print(arr[0])


